package study.translation.grammar;

import org.apache.log4j.Logger;

public class CheckGrammar
{
    private static Logger log = Logger.getLogger( CheckGrammar.class );

    public static void main( String[] args )
    {
        try
        {
            String filename = args[ 0 ];
            int k = Integer.parseInt( args[ 1 ] );

            GrammarLoader loader = new GrammarLoader( filename );
            Grammar grammar = loader.load();

            GrammarAnalyzer analyzer = new GrammarAnalyzer( grammar );
            analyzer.analyze( k );

            log.info( "Grammar is LL(" + k + ")" );
        }
        catch( Exception e )
        {
            log.error( e.getMessage() );
        }
    }
}
